package com.moleq.network;

import java.io.File;

import android.content.Context;

public class Constant {

	public final static String DATABASE_NAME = "mpos.db";
	public static final String DB_PACKAGE_NAME = "com.moleq.posdb";
	public static final String MGPOS_DB_PATH = "/data/data/com.moleq.posdb/databases/mpos.db";
	public static final int FILE_HANDLER_PORT = 6678;
	public static final int CMM_PORT = 6677;
	public static final String CMD_SEND_FILE = "com.ming.cmdsendfile";
	public static final String CMD_CONNECT = "com.ming.connect";
	public static int bufferSize = 256;

	public static final int readBufferSize = 4096;
	public static final String CMD_RESPONSE = "com.ming.cmd.reponse";
	public static final String CMD_REQUEST = "com.ming.cmd.request";
	public static final String CMD_UPDATE_ME = "com.ming.cmd.updateme";
	public static final String CMD_PING_IP = "com.ming.cmd.ping.ip";

	public static final String startServiceAction = "com.ming.startServiceAction";
	public static final String stopServiceAction = "com.ming.stopServiceAction";
	public static final String bootCompletedAction = "android.intent.action.BOOT_COMPLETED";
	public static final int MY_LOACL_IP = 0;

	// public static String IN_BOX = "/inbox/";
	// public static String OUT_BOX = "/outbox/";
//	public static int SERVER_PORT = 6677;
//	public static int SEND_FILE_PORT = 6688;
	public static String APP_PATH = "";
	public static String SDCARD = android.os.Environment.getExternalStorageDirectory().getAbsolutePath();

	public static final String SDCARD_IN_BOX 			= SDCARD + "/MoleQ/inbox/";
	public static final String SDCARD_OUT_BOX 			= SDCARD + "/MoleQ/outbox/";
	public static final String SDCARD_EXPORT 			= SDCARD + "/MoleQ/export/";
	public static final String SDCARD_MGPOS_CACHE 		= SDCARD + "/MoleQ/cache/";
	public static final String SDCARD_LOG_FOLDER 		= SDCARD + "/MoleQ/log/";
//	public static final String SDCARD_LOG 				= SDCARD + "/MoleQ/log.txt";
	public static final String LOG_FILE_NAME 			= "issue.log";
	public static final String TASK_XML_FILE_NAME 		= "Task{%s}.xml";
	public static final String DATA_XML_FILE_NAME 		= "Data{%s}.xml";
	public static final int REMOTE_REPORT_PORT = 6679;
	
	//
	public static final String GET = "com.moleq.action.get";
	public static final String RPT_FIXED_TOTAL = "com.moleq.report.fixedtotal";
	public static final String RPT_FUNCTION = "com.moleq.report.function";
	public static final String RPT_SCANNING_ITEM = "com.moleq.report.scanningitem";
	public static final String RPT_DEPARTMENT = "com.moleq.report.department";
	public static final String RPT_GROUP = "com.moleq.report.group";
	public static final String RPT_PLU_MULTI_TARE = "com.moleq.report.plu.multi.tare";
	
	public static final String RECEIVING_INQUIRY = "com.moleq.report.receiving_inquiry";
	public static final String INVENTORY = "com.moleq.report.inventory";
	
	public static final int RPT_TYPE_COLLECTION = 0 ;//"com.moleq.report.type.collection";
	public static final int RPT_TYPE_CONSOLIDATION = 1;//"com.moleq.report.type.consolidation";

	public static File IN_FOLDER = new File(SDCARD_IN_BOX);
	public static File OUT_FOLDER = new File(SDCARD_OUT_BOX);
	public static Context shareContext = null;

	public static Context getShareContext(Context context) {

		Context sharedContext = null;
		try {
			sharedContext = context.createPackageContext(DB_PACKAGE_NAME, Context.CONTEXT_IGNORE_SECURITY);
			if (sharedContext == null) {
				return context;
			}
		} catch (Exception e) {
			String error = e.getMessage();
			return context;
		}

		return sharedContext;
	}
}
